<?php

class liveView
{
	var $port;
	var $message;
	
	function liveView($id)
	{
		include_once('includes/addMessage.php');
		
		global $db, $lang;
		$q = 'SELECT * FROM ' . LIVEVIEWS_TABLE . ' WHERE lv_enabled = 1';
		$curId = 0;
		$curText = '';
                $curPort = 0;
                $select = '';
		$found = false;
		$result = $db->sql_query($q);
		while($row = $db->sql_fetchrow($result)) 
		{
			if($row['lv_id'] == $id || $curId == 0)
			{
				$curId = $row['lv_id'];
				$curText = $row['lv_title'];
                                $curPort = $row['lv_port'];
			}
			$select .= '<a href="liveview.php?id=' . $row['lv_id'] . '">'.$row["lv_class"] . ' ' . $row["lv_title"].'</a> | ';
		}
		
                $select = substr($lang['OtherServers'] . $select, 0, -2);
		$this->message = new addMessage($select,$curText);
		$this->port = $curPort;
	}


	function render()
	{
		$this->message->render();
		echo '<iframe src ="rfquery/display_rfactor_server.php?port=' . $this->port . '" width="800px" height="600px"></iframe>';
		
	}
}

?>